<?php
	// 允许跨域资源访问
	header("Access-Control-Allow-Origin:*");
	// 从 POST 请求中获取注册用户信息
	$phone = $_POST["phone"];
	$password = $_POST["password"];
	
	// 保存信息
	$conn = mysqli_connect("localhost","root","root","my_pc_ecommerce");
	$sql = "INSERT INTO pc_users (phone ,password) VALUES ('$phone',  '$password')";
	//执行sql
	$result = mysqli_query($conn,$sql);
	if($result){
		$arr = array("res_code"=>1, "res_message"=>"success");
		echo json_encode($arr);
	}else{
		// 插入数据失败
		$arr = array("res-code"=>-1,"res_message"=>"failed: ".mysqli_error($conn) );
		echo json_encode($arr);
	}
	
	//关闭数据库连接
	mysqli_close($conn);
?>